//
//  MyViewController.m
//  NBAApp
//
//  Created by 刘意明 on 16/12/1.
//  Copyright © 2016年 Manito. All rights reserved.
//

#import "MyViewController.h"
#import "MyView.h"
#import <ShareSDK/ShareSDK.h>//第三方登录
#import <ShareSDKUI/ShareSDK+SSUI.h>
@interface MyViewController ()<UITableViewDelegate,UITableViewDataSource>
{
    MyView *Mya;
    NSArray *MyText;//我的主队
    NSArray *MyImage;
    NSArray *MySe;//我的设置
    NSArray *MySeimage;
}
@property(nonatomic,strong)UIView *mmview;
@end

@implementation MyViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationItem.title=@"我";
    //我的主队
    MyText =[NSArray arrayWithObjects:@"我的主队",@"推送消息",@"我的收藏", nil];
    MyImage=[NSArray arrayWithObjects:@"球队.png",@"消息推送(1).png",@"收藏.png", nil];
    //我的设置
    MySe =[NSArray arrayWithObjects:@"设置",@"清理缓存", nil];
    MySeimage =[NSArray arrayWithObjects:@"设置(1)",@"清理缓存(1)", nil];
    
    self.hidesBottomBarWhenPushed=NO;

    
    Mya =[[MyView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight)];
    Mya.Mytable.delegate = self;
    Mya.Mytable.dataSource = self;
    self.view = Mya;
    //界面视图
    _mmview =[[UIView alloc] initWithFrame:CGRectMake(0, 64, ScreenWidth, 200)];
    _mmview.backgroundColor=[UIColor colorWithRed:38.00/225 green:70.00/225 blue:119.00/225 alpha:1.000];
    [self.view addSubview:_mmview];
    //view上的点击登录
    [self Entry];
}

#pragma mark 头像
//点击登录
-(void)Entry{
    UIButton *button  =[UIButton buttonWithType:UIButtonTypeCustom];
    button.frame=CGRectMake(135, 110, 130, 50);
    [button setTitle:@"点击登录" forState:UIControlStateNormal];
    button.titleLabel.font=[UIFont systemFontOfSize:20];
    [button setTitleColor:[UIColor whiteColor] forState: UIControlStateNormal];
    [button addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
    [_mmview addSubview:button];
    //头像
    UIButton *button1  =[UIButton buttonWithType:UIButtonTypeCustom];
    button1.frame=CGRectMake(160, 30, 80, 80);
    [button1 setImage:[UIImage imageNamed:@"人物(2).png"] forState:UIControlStateNormal];
    [button1 addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
    [_mmview addSubview:button1];
    

}
#pragma mark---跳转到微博登录
-(void)click:(UIButton *)aa
{
    [ShareSDK authorize:(SSDKPlatformTypeSinaWeibo) settings:nil onStateChanged:^(SSDKResponseState state, SSDKUser *user, NSError *error) {
    }];
}


#pragma mark --tableview的代理方法
//返回组数
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 2;
}
//行数
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if (section == 0 ) {
        return 3;
    }
    return 2;
}
//内容
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPat
{
static NSString *CellID =@"cell";
    UITableViewCell *cell =[Mya.Mytable dequeueReusableCellWithIdentifier:CellID];
    if (cell == nil) {
        cell =[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellID];
    }
    if (indexPat.section==0) {
        cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
        cell.textLabel.text=MyText[indexPat.row];
        cell.imageView.image=[UIImage imageNamed:MyImage[indexPat.row]];
    }
    if (indexPat.section==1) {
        cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
        cell.textLabel.text=MySe[indexPat.row];
        cell.imageView.image=[UIImage imageNamed:MySeimage[indexPat.row]];
    }
    return cell;
}
//距离顶部距离
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 10;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 50;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
